package com.liuzheng.actiondemo;

public class Test {
    public static void main(String[] args) {
        int[] arr = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15};
        //打乱数组
        for (int i = 0; i < arr.length; i++) {
            int random = (int) (Math.random() * arr.length);
            int temp = arr[i];
            arr[i] = arr[random];
            arr[random] = temp;
        }
        //定义一个二维数组
        int[][] arr2 = new int[4][4];

        for (int i = 0; i < arr.length; i++) {
            arr2[i/4][i%4] = arr[i];
        }
        for (int i = 0; i < arr2.length; i++) {
            for (int j = 0; j < arr2[i].length; j++) {
                System.out.print(arr2[i][j] + " ");
            }
            System.out.println();
        }
    }
}
